﻿@model WebUI.Models.Catalog
@{string[] cids = ViewBag.cids==null? new string[0]:ViewBag.cids as string[];
}
<div class='@("SuiFang".Equals(Model.RootFlag) ? "catalog-title" : string.Empty)'>
    @if ("SuiFang".Equals(Model.RootFlag))
    { 
        @Ajax.ActionLink(Model.Title, "SuiFangForm", new { ID = Model.CatalogID }
, new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "SuiFangFormView", HttpMethod = "Get", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError" })

        <script type="text/javascript">
            $(function () {
                $("#treeview").treeview();
            });
        </script>
    }
    else
    {
        @Ajax.ActionLink(Model.Title, "SuiFangForm", new { ID = Model.CatalogID }
, new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "SuiFangFormView", HttpMethod = "Get", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError" })
    }
</div>
@if (Model.SubCatalogs.Count > 0)
{
    <ul id="sftc@(Model.CatalogID)">
        @foreach (var item in Model.SubCatalogs)
        {
            <li class="@(cids.Contains(item.CatalogID)?"":"closed")" id="sft@(item.CatalogID)">
                @Html.Partial("SuiFangTree", item) </li>
        }
    </ul>
}
